<? 
include("session.php"); 
$admin_agent_ids = array("hncsgj00","hncsgj01");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style> a {color:blue; font-size:12px} </style>
<script type="text/javascript" src="../../../webkit/utils/jquery.js"></script>
</head>
<base target="hngj_main_frame"/>
<body  bgcolor="#f4f4f4" style="margin:5px; font-size:12px" scroll=no onload="init()">
<?if(in_array($_SESSION['hngj_agent_id'], $admin_agent_ids)) {?>
【<a href='task_list.php'>任务管理</a>】　
【<a href='agent_list.php'>座席列表</a>】　
【<a href='report_list.php'>统计报表</a>】　
<?}?>
【<a href='call_list.php?agent_id=<?echo $_GET['agent_id']?>'>外呼列表</a>】<!--　【<a href='http://222.240.139.227/reportview/frame/navigation.jsp?__report=rpt_agent_workload_by_time.rptdesign'>报表统计</a>】-->　　
[<span id="the_latest_task" style="color:red"></span>]营销前3名<img src='hot.gif' width=26 height=12>：<span style='color:gray' id="agent_score_tips">暂无</span>

<script>
	var agent_id = "<?echo $_GET['agent_id']?>";
	function keep_session_alive() {
		$.get("session.php?agent_id="+agent_id);
	}
	window.setInterval("keep_session_alive()", 60*1000);

	function refresh_agent_score(task_id) {
		$.get("report_query.php?action=get_agent_score&task_id="+task_id, function(data){
			var str = "";
			if(data.replace(/[\s]/g, '') == "") {
				str = "<font color=gray>今天暂无营销成功记录</font>";
			} else {
				var arr = data.split("$");
				var html = [];
				for(var i=0; i<arr.length; i++) {
					var rec = arr[i].split(",");
					html.push("<font color='blue'>"+rec[1]+"</font>--<font color='black'>成功(<font color='red' style='font-weight:bold'>"+rec[0]+"</font>)条</font><img src='hot2.gif'>")
				}
				str = html.join("　");
			}
			$("#agent_score_tips").html(str + "　[<a href=\"javascript:parent.frames['hngj_main_frame'].show_agent_score("+task_id+")\">查看全部</a>]");
		});
	}
	

	function get_the_latest_task() {
		$.get("report_query.php?action=get_the_latest_task", function(data){
			var arr = data.split(",");
			var task_id = arr[0];
			$("#the_latest_task").html(arr[1]);
			refresh_agent_score(task_id);
		});
	}

	function init() {
		get_the_latest_task();
		window.setInterval("get_the_latest_task()", 30 * 1000);
	}
</script>
</body>
</html>